﻿using System;
using System.Runtime.Serialization;
using NCMIS.ObjectModel.MetaData;

namespace NCMIS.ObjectModel.Rest
{
    /// <summary>
    /// Reperesents a URI template, that is used to make service method calls using the REST/AtomPub binding.
    /// </summary>
    [DataContract(Name = "uritemplate", Namespace = CmisNs.Cmisra)]
    public class CmisUriTemplate
    {
        #region Templates defined by CMIS

        /// <summary>
        /// Represents the ObjectById URI template.
        /// </summary>
        [IgnoreDataMember]
        public const string ObjectById = "{repositoryId}/objectbyid/{id}?filter={filter}&includeAllowableActions={includeAllowableActions}&includePolicyIds={includePolicyIds}&includeRelationships={includeRelationships}&includeACL={includeACL}";
        /// <summary>
        /// Represents the ObjectByPath URI template.
        /// </summary>
        [IgnoreDataMember]
        public const string ObjectByPath = "{repositoryId}/objectpath/{path}?filter={filter}&includeAllowableActions={includeAllowableActions}&includeRelationships={includeRelationships}&renditionFilter={renditionFilter}&includePolicyIds={includePolicyIds}&includeACL={includeACL}";
        /// <summary>
        /// Represents the TypeById URI template.
        /// </summary>
        [IgnoreDataMember]
        public const string TypeById = "{repositoryId}/type/{typeId}";
        /// <summary>
        /// Represents the Query URI template.
        /// </summary>
        [IgnoreDataMember]
        public const string Query = "{repositoryId}/query?statement={statement}&searchAllVersions={searchAllVersions}&includeAllowableActions={includeAllowableActions}&includeRelationships={includeRelationships}&renditionFilter={renditionFilter}&maxItems={maxItems}&skipCount={skipCount}";

        #endregion

        /// <summary>
        /// The template definition.
        /// </summary>
        [DataMember(Name = "template", Order = 1)]
        public string Template
        {
            get;
            set;
        }

        /// <summary>
        /// The template type, within the CMIS model.
        /// </summary>
        [DataMember(Name = "type", Order = 2)]
        public string Type
        {
            get;
            set;
        }

        /// <summary>
        /// The template media type.
        /// </summary>
        [DataMember(Name = "mediatype", Order = 3)]
        public string MediaType
        {
            get;
            set;
        }
    }
}
